package atomlist;

import java.util.Deque;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * @功能
 * @创建时间 2019/12/21
 */
public class T04_ConcurrentQueue {
    public static void main(String[] args) {
/*        Deque<String> strs = new ConcurrentLinkedDeque<>(); //双端队列
        strs.offerFirst("1");
        strs.offerLast("1");
        strs.peekFirst();
        strs.peekLast();
        strs.pollFirst();
        strs.pollLast()*/
        Queue<String> strs = new ConcurrentLinkedQueue<>();
        for(int i=0;i <10;i++){
        strs.offer("a"+i); //add
        }
        System.out.println(strs);
        System.out.println(strs.size());
        System.out.println(strs.poll());  //拿第一个同时删掉那个
        System.out.println(strs.size());
        System.out.println(strs.peek());  //拿第一个但不删
        System.out.println(strs.size());
    }
// 双端队列Deque
}
